package org.weasel.business;

import java.util.ArrayList;

public class Release {

	private String id;

	private String name;

	private ArrayList<Iteration> iterations;

	private Unscheduled unscheduled;
	
	private String notes;
	private String startDate;
	private String endDate;

	public Release(String id, String name, ArrayList<Iteration> iterations,
			Unscheduled unscheduled, String notes) {
		this.id = id;
		this.name = name;
		this.notes = notes;
		if (iterations != null)
			this.iterations = iterations;
		else
			this.iterations = new ArrayList<Iteration>();
		this.unscheduled = unscheduled;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

	public String getId() {
		return id;
	}

	public ArrayList<Iteration> getIterations() {
		return iterations;
	}

	public void setIterations(ArrayList<Iteration> iterations) {
		this.iterations = iterations;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Unscheduled getUnscheduled() {
		return unscheduled;
	}

	public void setUnscheduled(Unscheduled unscheduled) {
		this.unscheduled = unscheduled;
	}

	public void addIteration(Iteration iteration) {
		iterations.add(iteration);
	}

	public void removeIteration(String id) {
		Iteration iteration;
		for (int i = 0; i < iterations.size(); i++) {
			iteration = iterations.get(i);
			if (iteration.getId().equals(id)) {
				iterations.remove(i);
				return;
			}
		}
	}

	public Iteration getIteration(String id) {
		for (Iteration iteration : iterations) {
			if (iteration.getId().equals(id))
				return iteration;
		}
		return null;
	}
	
	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

}
